package com.sundi.ecsystem.web;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sundi.eccommon.dto.EcRoleDto;
import com.sundi.eccommon.vo.ResultEntity;
import com.sundi.ecsystem.entity.EcRole;
import com.sundi.ecsystem.service.IEcRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Mht
 * @since 2020-02-25
 */
@RestController
@RequestMapping("/ecRole")
public class EcRoleController {

    @Autowired
    IEcRoleService roleService;

    @RequestMapping("roleList")
    public ResultEntity list(EcRoleDto ecRoleDto){
        PageHelper.startPage(ecRoleDto.getPageNum(),ecRoleDto.getPageSize());
        List<EcRole> ecUsers = roleService.selectRoleList(ecRoleDto);
        PageInfo<EcRole> pageInfo  = new PageInfo<>(ecUsers);
        return ResultEntity.ok(pageInfo);
    }



}
